{{> header }}

// import type lookup before we augment - in some environments
// this is required to allow for ambient/previous definitions
import '@polkadot/api-base/types/storage';

{{{ importsAll }}}

export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
export type __QueryableStorageEntry<ApiType extends ApiTypes> = QueryableStorageEntry<ApiType>;

declare module '@polkadot/api-base/types/storage' {
  interface AugmentedQueries<ApiType extends ApiTypes> {
    {{#each modules}}
    {{{name}}}: {
      {{#each items}}
      {{> docs}}
      {{{name}}}: {{{entryType}}}<ApiType, ({{{params}}}) => Observable<{{{returnType}}}>, [{{{args}}}]>{{#unless @root.isStrict}} & QueryableStorageEntry<ApiType, [{{{args}}}]>{{/unless}};
      {{/each}}
      {{#unless @root.isStrict}}
      /**
       * Generic query
       **/
      [key: string]: QueryableStorageEntry<ApiType>;
      {{/unless}}
    };
    {{/each}}
  } // AugmentedQueries
} // declare module
